<html>
<head><meta charset="utf-8"><title>diagnostic output differs w/ vs w/o -O · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html">diagnostic output differs w/ vs w/o -O</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="146942155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942155">(Nov 07 2018 at 14:17)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124288">@Oli</span> while investigating issues associated with PR <a href="https://github.com/rust-lang/rust/issues/55532" target="_blank" title="https://github.com/rust-lang/rust/issues/55532">#55532</a>, I encountered the following seeming oddity: on the test in question, I get <em>slightly</em> different diagnostic output based on whether I do or don't include <code>-O</code></p>



<a name="146942209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942209">(Nov 07 2018 at 14:17)</a>:</h4>
<p>I wanted to know if 1. you are aware of this, 2. if its currently expected behavior, and 3. if there's any hope of ... eliminating the difference here?</p>



<a name="146942635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942635">(Nov 07 2018 at 14:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> seems to be related to overflow checks?</p>



<a name="146942670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942670">(Nov 07 2018 at 14:23)</a>:</h4>
<p>Oh ... because our semantics for overflow differ for with <code>-O</code> vs without, hmmm, yes?</p>



<a name="146942671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942671">(Nov 07 2018 at 14:23)</a>:</h4>
<p>for anything MIR-based, that is kind-of expected. Not sure how much can be done. The MIR, once generated, encodes whether arithmetic is checked for overflow or not, so anything just executing the MIR will only do overflow checks in debug mode</p>



<a name="146942679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942679">(Nov 07 2018 at 14:23)</a>:</h4>
<p>the thing is the semantics of MIR <em>do not</em> differ</p>



<a name="146942689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942689">(Nov 07 2018 at 14:23)</a>:</h4>
<p>MIR building differs</p>



<a name="146942747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942747">(Nov 07 2018 at 14:24)</a>:</h4>
<p>(I cannot remember now whether the intention was for such checks to be controlled via <code>-O</code> or <code>-g</code>, but either way, its an excellent hypothesis for why this is arising)</p>



<a name="146942757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942757">(Nov 07 2018 at 14:24)</a>:</h4>
<p>I once was foolish enough to think that I could make MIR interpretation (miri/CTFE) check for overflow even when the MIR does not ask for it</p>



<a name="146942763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942763">(Nov 07 2018 at 14:24)</a>:</h4>
<p>half a year later we had a segfault because of that^^</p>



<a name="146942770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942770">(Nov 07 2018 at 14:24)</a>:</h4>
<p>wait, what?</p>



<a name="146942779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942779">(Nov 07 2018 at 14:25)</a>:</h4>
<p>can you point me to the issue?</p>



<a name="146942803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942803">(Nov 07 2018 at 14:25)</a>:</h4>
<p>well there were other things playing into this as well, it was because promotion happened and CTFE did not the same thing as run-time code</p>



<a name="146942836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942836">(Nov 07 2018 at 14:25)</a>:</h4>
<p>that's just to explain why we do overflow checks only when the MIR explicitly asks for it</p>



<a name="146942904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942904">(Nov 07 2018 at 14:26)</a>:</h4>
<blockquote>
<p>can you point me to the issue?</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/50814" target="_blank" title="https://github.com/rust-lang/rust/issues/50814">https://github.com/rust-lang/rust/issues/50814</a></p>



<a name="146942938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942938">(Nov 07 2018 at 14:27)</a>:</h4>
<p>the interesting thing to me here is that the diagnostic output is <em>so</em> similar</p>



<a name="146942942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942942">(Nov 07 2018 at 14:27)</a>:</h4>
<p><code>const_prop</code> however does special magic to still do overflow checks even in release mode, I think</p>



<a name="146942948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942948">(Nov 07 2018 at 14:27)</a>:</h4>
<p>maybe that special magic is not quite close enough to what debug mode does</p>



<a name="146942949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942949">(Nov 07 2018 at 14:27)</a>:</h4>
<p>like, it seems like const_eval is reporting a problem in either case</p>



<a name="146942955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942955">(Nov 07 2018 at 14:27)</a>:</h4>
<p>but it gets tied in with the other overflow checking in different ways....?</p>



<a name="146942956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942956">(Nov 07 2018 at 14:27)</a>:</h4>
<p>no const_eval involved here</p>



<a name="146942959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942959">(Nov 07 2018 at 14:27)</a>:</h4>
<p>...</p>



<a name="146942961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942961">(Nov 07 2018 at 14:27)</a>:</h4>
<p>this is not in const context</p>



<a name="146942965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146942965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146942965">(Nov 07 2018 at 14:27)</a>:</h4>
<p>this is <code>const_prop</code></p>



<a name="146943018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943018">(Nov 07 2018 at 14:28)</a>:</h4>
<p>which opportunistically walks over <em>runtime</em> MIR and interprets the parts of it that it can to provide some diagnostics</p>



<a name="146943029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943029">(Nov 07 2018 at 14:28)</a>:</h4>
<p>its a bad, horrible hack^^</p>



<a name="146943031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943031">(Nov 07 2018 at 14:28)</a>:</h4>
<p><code>let x: i8 = --128;</code> is not const context?</p>



<a name="146943036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943036">(Nov 07 2018 at 14:28)</a>:</h4>
<p>uh, no?</p>



<a name="146943039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943039">(Nov 07 2018 at 14:28)</a>:</h4>
<p>okay hey I don't know</p>



<a name="146943040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943040">(Nov 07 2018 at 14:28)</a>:</h4>
<p>there's no <code>const</code> there</p>



<a name="146943046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943046">(Nov 07 2018 at 14:28)</a>:</h4>
<p>okay :)</p>



<a name="146943063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943063">(Nov 07 2018 at 14:28)</a>:</h4>
<p>you have to ask for const context with <code>const</code></p>



<a name="146943067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943067">(Nov 07 2018 at 14:28)</a>:</h4>
<p>I see</p>



<a name="146943070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943070">(Nov 07 2018 at 14:29)</a>:</h4>
<p>otherwise its not const context</p>



<a name="146943077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943077">(Nov 07 2018 at 14:29)</a>:</h4>
<p>I should see how this behaves if you do that</p>



<a name="146943082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943082">(Nov 07 2018 at 14:29)</a>:</h4>
<p>with one glaring exception: promotion</p>



<a name="146943103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943103">(Nov 07 2018 at 14:29)</a>:</h4>
<p>promotion makes some things const context that the user didnt write in const context.</p>



<a name="146943104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943104">(Nov 07 2018 at 14:29)</a>:</h4>
<p>okay, is this a case where promotion applies then?</p>



<a name="146943113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943113">(Nov 07 2018 at 14:29)</a>:</h4>
<p>but in this case, there's no promotion, so this must be the <code>const_prop</code> pass</p>



<a name="146943116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943116">(Nov 07 2018 at 14:29)</a>:</h4>
<p>(because I think that was what I was thinking of. Sure, yeah, that's the ticket)</p>



<a name="146943133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943133">(Nov 07 2018 at 14:30)</a>:</h4>
<p>There's no promotion... because its not a <code>&amp;--128</code> or something?</p>



<a name="146943183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146943183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146943183">(Nov 07 2018 at 14:30)</a>:</h4>
<p>exactly</p>



<a name="146945998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146945998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146945998">(Nov 07 2018 at 14:35)</a>:</h4>
<p>Const prop is slightly hacky, because it had to replicate the old const folding const evaluator</p>



<a name="146946824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146946824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146946824">(Nov 07 2018 at 14:36)</a>:</h4>
<p>We could make const prop deterministic, so that --release overflows are also detected</p>



<a name="146948088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146948088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146948088">(Nov 07 2018 at 14:38)</a>:</h4>
<p>But we need to have a big discussion about the future of const prop anyway... I don't think it is good the way it is, because we're partially reimplementing miri</p>



<a name="146949667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/diagnostic%20output%20differs%20w/%20vs%20w/o%20-O/near/146949667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/diagnostic.20output.20differs.20w.2F.20vs.20w.2Fo.20-O.html#146949667">(Nov 07 2018 at 14:40)</a>:</h4>
<p>Okay. Well this isn't the only case of a test that depends on the <code>-O</code> flag (cc <a href="#narrow/stream/131828-t-compiler/subject/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F" title="#narrow/stream/131828-t-compiler/subject/Tests.20with.20optimization-level.20specified.20by.20the.20test.3F">T-compiler topic</a>), so I'll leave this be for now</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>